package com.wuwei.elearning.question.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wuwei.elearning.question.domain.Question;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 保存题目信息的表，不管是机型题，基础执照题，还是英语题，都保存在该表中 Mapper 接口
 * </p>
 *
 * @author wuwei
 * @since 2024-01-20
 */
public interface QuestionMapper extends BaseMapper<Question> {

    List<Question> mySelect(Long selectedId);

    List<Question> mySelectCollect(@Param("account") Long account, @Param("selectedId") Long selectedId);

    List<Question> mySelectWrong(@Param("account") Long account, @Param("selectedId") Long selectedId);

    /**
     * 随机获得question
     * @param selectedId
     * @return
     */
    List<Long> mySelectRandom(@Param("selectedId") Long selectedId,@Param("count") Integer count);

    Integer setSubjectId(@Param("questionIds") List<Long> questionIds, @Param("subjectId") Long subjectId);

    List<Question> randomSelectBySpecialCareId( @Param("subjectId") Long subjectId,@Param("specialCareId") Integer specialCareId, @Param("count") Integer count);

    List<Question> randomSelect(@Param("selectedId") Long selectedId,@Param("count") Integer count);

    List<Question> randomSelectWithoutInQid(@Param("selectedId") Long selectedId,@Param("count") Integer count, @Param("qid") ArrayList<Long> qid);
    /**
     * 根据question表的subjectId从中随即筛选出quesitonNum数量的题目
     * @param subjectIds
     * @return
     */
    List<Long> myListRandom(@Param("subjectIds") List<Long> subjectIds, @Param("quesitonNum") Integer quesitonNum);


    /**
     * 根据number和subjectId从question表中随机选取一定数量的题目
     * @param subjectId question表的subject_id
     * @param number 随机的数量
     * @return 获取选取的question的主键
     */
    List<Long> subjectRandomTest(@Param("subjectId") Long subjectId, @Param("number") Integer number);

    /**
     * 查询question表中subjectId字段在subject表中找不到的数据
     * @param name
     * @return
     */
    Long noSubjectTotal(String name);

    /**
     * 查询question表中subjectId字段在subject表中找不到的数据
     * @param offset
     * @param pageSize
     * @param name
     * @return
     */
    List<Question> noSubjectList(@Param("offset") int offset, @Param("pageSize") int pageSize, @Param("name") String name);


}
